﻿@model PhoneBilling.Models.DiscountModel
@{
    ViewBag.Title = "优惠表编辑";
    Layout = "~/Views/Shared/_Layout.cshtml";
}
<script type="text/javascript">       
    $(document).ready(           
    function () 
    {  
        $(".myDatePickerClass1 ").datepicker({  
            buttonImage: '@Url.Content("~/Content/image/calendar.gif")',               
            dateFormat: 'yy/mm/dd',                 
            showOn: 'button',               
            buttonImageOnly: true ,
            changeMonth:true,              
            changeYear:true,
        });   
        $(".myDatePickerClass2 ").datepicker({
            buttonImage: '@Url.Content("~/Content/image/calendar.gif")',               
            dateFormat: 'yy/mm/dd',                 
            showOn: 'button',               
            buttonImageOnly: true ,
            changeMonth:true,              
            changeYear:true,
        });
        $(".areaType").attr("disabled" , $(".s2").attr("checked") == "checked");
        $(".t2").attr("disabled", $(".s1").attr("checked") == "checked");
    }       
    );
    

function changeAreaType() 
{
     var str = "";
     $(".areaType").each(function()
     {
        if($(this).attr("checked") == "checked")
        {
            str += $(this).attr("id");
        }
     });
     $("#areaType").val(str);
}

function state1() 
{
    $(".areaType").attr("disabled" , $(".s1").attr("checked") == "undifined");
    $(".t2").attr("disabled", $(".s1").attr("checked") == "checked");
}
function state2() 
{
    $(".areaType").attr("disabled" , $(".s2").attr("checked") == "checked");
    $(".t2").attr("disabled", $(".s2").attr("checked") == "undifined");
}
</script>

@using (Html.BeginForm())
{ 
    <div >
        <div class="input-text">
             @Html.HiddenFor(m =>m.ItemNo)
             @Html.HiddenFor(m =>m.IsNew)
             @Html.LabelFor(m => m.优惠名称)
             @Html.TextBoxFor(m => m.优惠名称)
             @Html.ValidationMessageFor(m => m.优惠名称, new { style = "color:Red" })

        </div>
        
        <div class="input-text">
             @Html.LabelFor(m => m.起始时间)
             @Html.TextBox("起始时间", Model.起始时间.ToString("d"), new { @class = "myDatePickerClass1" }) 
             @Html.ValidationMessageFor(m => m.起始时间, new { style = "color:Red" })
             @Html.TextBox("起始时间Time", Model.起始时间Time.ToString("HH:mm:ss")) 
             @Html.ValidationMessageFor(m => m.起始时间Time, new { style = "color:Red" })
        </div>
        <div class="input-text">
             @Html.LabelFor(m => m.终止时间)
             @Html.TextBox("终止时间", Model.终止时间.ToString("d"), new { @class = "myDatePickerClass2" }) 
             @Html.ValidationMessageFor(m => m.终止时间, new { style = "color:Red" })
             @Html.TextBox("终止时间Time", Model.终止时间Time.ToString("HH:mm:ss")) 
             @Html.ValidationMessageFor(m => m.终止时间Time, new { style = "color:Red" })
        </div>
        <div class="input-text">
             @Html.RadioButtonFor(m => m.折扣类别, "话类", new { onclick = "state1()", @class = "s1" })
             @Html.LabelFor(m => m.优惠话类)
             @Html.HiddenFor(m => m.优惠话类, new { id = "areaType" })
    @{
        for (int i = 0;i <Model.优惠话类List.Count;i++)
        {
            @Html.CheckBoxFor(m =>m.优惠话类List[i].IsSelected , new {  onclick="changeAreaType()", @class="areaType", id=Model.优惠话类List[i].ID })
            @Html.Label(string.Format(" {0} " ,Model.优惠话类List[i].Name))
        }
    }
        </div>
        <div class="input-text">
            @Html.RadioButtonFor(m => m.折扣类别, "区号", new { onclick = "state2()", @class = "s2" })
            @Html.LabelFor(m => m.优惠区号)
            @Html.TextBoxFor(m => Model.优惠区号, new { @class = "t2" }) 
        </div>
        <div class="input-text">
           @Html.LabelFor(m => m.基本费折扣)
           @Html.TextBox("基本费折扣", Model.基本费折扣) 
           @Html.ValidationMessageFor(m => m.基本费折扣, new { style = "color:Red" })
        </div>
        <div class="input-text">
           @Html.LabelFor(m => m.附加费折扣)
           @Html.TextBox("附加费折扣", Model.附加费折扣) 
           @Html.ValidationMessageFor(m => m.附加费折扣, new { style = "color:Red" })
        </div>
        <div class="input-text">
           @Html.LabelFor(m => m.服务费折扣)
           @Html.TextBox("服务费折扣", Model.服务费折扣) 
           @Html.ValidationMessageFor(m => m.服务费折扣, new { style = "color:Red" })
        </div>
        <p class="submit">
            <input type="submit" value="确定" class="input-submit" />
        </p>
    </div>
}
